Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release to npm #394

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Release to npm #394

wants to merge 1 commit into from

Conversation

lkostrowski
Copy link
Member

@lkostrowski lkostrowski commented Jan 28, 2025

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@saleor/[email protected]

Major Changes

  • 3dfb91c: requiredEnvVars param was removed trom SaleorApp. Field was not used internally. Apps should validate it's envs.

  • 51caa77: Removed /middlewares, you should use /handlers instead.

  • 51caa77: Removed deprecated fields fields and methods in /handlers:

    • SaleorAsyncWebhook and SaleorSyncWebhook - removed deprecated asyncEvent and subscriptionQueryAst
    • Removed processSaleorWebhook and processProtectedHandler methods in favor of SaleorSyncWebhook, SaleorAsyncWebhook classes and createProtectedHandler handler
    • Some types were moved from /next to /shared
  • a915771: ### APL

    • isReady and isConfigured methods are now optional in the APL interface
    • All APL implementations are now exported from dedicated paths @saleor/app-sdk/APL/* where * is one of the implementations. Now tree shaking is available
  • 126493d: Generating AppBridge action now uses native web API Crypto.

    • Some older browser may not be working
    • Only localhost and https is supported now
  • 5b0f7a8: Removed ctx.buildResponse parameter from SyncWebhookHandler ctx and replace with standalone buildSyncWebhookResponsePayload function

    Before

    new SaleorSyncWebhook(...).createHandler(
      req, res, ctx
    ) {
    
      const typeSafePayload = ctx.buildResponse({
        // this must be valid response
      })
    }

    After

    import { buildSyncWebhookResponsePayload } from "@saleor/app-sdk/handlers/shared";
    
    new SaleorSyncWebhook(...).createHandler(
      req, res, ctx
    )
    {
    
      const typeSafePayload = buildSyncWebhookResponsePayload<"ORDER_CALCULATE_TAXES">({
        // this must be valid shape
      })
    }

    This change reduces complexity of TypeScript generics and make it easier to build abstractions on top of built-in handlers

  • 3dfb91c: Saleor version that was previously represented as a floating number (eg Saleor 3.20 was represented as 3.2) is now a SaleorSchemaVersion which is a tuple major: number, minor: number. This format is now passed to Manifest handler and webhooks handler

  • c956220: Breaking change: SDK will no longer check saleor-domain header when validating Saleor requests, instead it will check saleor-api-url header.

Minor Changes

  • 4fa8271: Added handlers for Web API: Request and Response

    Example

    This example uses Next.js app router

    /* /app/api/manifest/route.ts */
    import { createManifestHandler } from "@saleor/app-sdk/handlers/fetch-api";
    // or
    import { createManifestHandler } from "@saleor/app-sdk/handlers/next-app-router";
    
    export const GET = createManifestHandler({
      manifestFactory({ appBaseUrl, request }) {
        return {
          name: "Saleor App Template",
          tokenTargetUrl: `${appBaseUrl}/api/register`,
          appUrl: appBaseUrl,
          permissions: ["MANAGE_ORDERS"],
          id: "saleor.app",
          version: "0.0.1",
          webhooks: [orderCreatedWebhook.getWebhookManifest(apiBaseURL)],
          author: "Saleor Commerce",
        };
      },
    });
    /* /app/api/register/route.ts */
    import { createAppRegisterHandler } from "@saleor/app-sdk/handlers/fetch-api";
    
    export const POST = createAppRegisterHandler({
      apl: saleorApp.apl,
    });

    To see more details check these examples:

  • 51caa77: Added abstract PlatformAdapterInterface and ActionHandlerInterface to enable cross-framework handler implementations.

    Next.js handlers were rewritten to use the new interface.

  • 5e4eb20: Add new exported path "util" with helper methods like parseSchemaVersion

Patch Changes

  • 003b1ca: Added author and license fields to pacakge.json

  • 003b1ca: Updated project license: it previously used BSD 3-Clause for code and Creative Commons Attribution 4.0 International License for artwork.
    Since this project doesn't include any artwork, Creative Commons license was removed.

    Updated license field in package.json: It incorrectly stated ISC license instead of BSD-3-Clause.

  • 8f6b437: Updated Typescript

  • 0a917ac: Updated packages: vite, vitest, raw-body, prettier, tsup, jose

  • 5fb68e6: Schema version passed to manifest handler will be string, not float

  • 853abaa: Added AWS Lambda platform handlers

    Check this example on how to use it.

@lkostrowski lkostrowski requested a review from a team as a code owner January 28, 2025 07:43
@lkostrowski lkostrowski added the v1 label Jan 28, 2025
Copy link

codecov bot commented Jan 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.40%. Comparing base (5e4eb20) to head (9bc95d0).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #394   +/-   ##
=======================================
  Coverage   83.40%   83.40%           
=======================================
  Files          99       99           
  Lines        3429     3429           
  Branches      587      587           
=======================================
  Hits         2860     2860           
  Misses        557      557           
  Partials       12       12           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lkostrowski lkostrowski changed the title Release to npm Release v1.0.0 Jan 28, 2025
@lkostrowski lkostrowski marked this pull request as draft January 28, 2025 07:44
@lkostrowski lkostrowski changed the title Release v1.0.0 Release to npm Jan 28, 2025
@lkostrowski lkostrowski force-pushed the changeset-release/main branch 4 times, most recently from cfddaf0 to 90d1d61 Compare February 3, 2025 16:08
@lkostrowski lkostrowski force-pushed the changeset-release/main branch 3 times, most recently from 01d71dc to 8d8e89a Compare February 11, 2025 12:31
@lkostrowski lkostrowski force-pushed the changeset-release/main branch 3 times, most recently from 3053ab2 to e03623c Compare February 20, 2025 07:54
@lkostrowski lkostrowski force-pushed the changeset-release/main branch 4 times, most recently from 2c1bf11 to c9620e3 Compare February 28, 2025 07:46
@lkostrowski lkostrowski force-pushed the changeset-release/main branch from c9620e3 to 9bc95d0 Compare February 28, 2025 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant